;--------------------------------------
;
; prog1-3.asm
;
; Demonstration of MASM 6.0 simplified 
; segment and conditional assembly for
; small and large memory models
;
;

; defines here

DOS_DISPLAY_STRING      equ       09h

; select memory model

IF mdl EQ 3
    .Model large
ELSE
    .Model small
ENDIF  

; Create stack

    .Stack                        ; 1 K by default

; Declare data segment

IF mdl EQ 3
    .Fardata
ELSE
    .Data
ENDIF

; message to be printed

hello    db    10,13,'Hello Chuck!',10,13,'$'  
        


; Begin code segment

    .Code

; Start program here

    .Startup

;--------------------------------------
;
; Main body of program here
; where DOS interrupt 21h function
; 09h is used to print the now-
; infamous "Hello CHuck!" message
; to the screen
;

IF mdl EQ 3
    push   ds                     ; save ds register
    mov    ax,SEG hello           ; set ds register to
    mov    ds,ax                  ; far data segment of
    assume ds:SEG hello           ; hello
ENDIF
    mov    dx,OFFSET hello        ; offset goes to dx
    mov    ah,DOS_DISPLAY_STRING  ; DOS function to display string
    int    21h                    ; DOS does printing
IF mdl EQ 3
    pop    ds                     ; restore ds
ENDIF

; End program and return to DOS

    .Exit

; End of ASSEMBLY source file

    END

;
;--------------------------------------
